import UtilsTemplate from '../../../components/UtilsTemplate';
import {moneyFormat} from '@/util/format';
export default {
	extends:UtilsTemplate,
	data(){
		return {
			apis:[
				{
					name:'格式化金额',
					info:'把一个实数格式化为整数部分每3位数一个逗号分隔',
					code:`
<script>
import {moneyFormat} from '@lexmis/baseui/src/util/format';

moneyFormat(12344567.126); //12,344,567
moneyFormat('12344567.126'); //12,344,567
moneyFormat(12344567.126,2); //12,344,567.13
moneyFormat('12344567.126',2); //12,344,567.13
</${'script'}>`,
					tabs:[
						{
							name:'moneyFormat(value, decimalDigits) => string',
							args:[
								{name:'value',info:'被格式化的实数',type:'number | string',def:''},
								{name:'decimalDigits',info:'保留的小数位数',type:'number',def:'0'},
							]
						}
					]
				}
			],
		};
	},
};
(function(){
	console.log('=========格式化金额=========');
	console.log(moneyFormat(12344567.126));
	console.log(moneyFormat('12344567.126'));
	console.log(moneyFormat(12344567.126,2));
	console.log(moneyFormat('12344567.126',2));
})();
